<meta name="csrf-token" content="{{ csrf_token() }}">

<div class="row">
    <div class="col-md-12">
        <div class="box">
            <div class="box-header">
                <div class="btn-group pull-right" style="margin-right: 10px">
                    <a href="/admin/camp/setting/create" class="btn btn-sm btn-success" title="新增">
                        <i class="fa fa-save"></i><span class="hidden-xs">&nbsp;&nbsp;新增</span>
                    </a>
                </div>
            </div>
            <div class="box-body">
                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th>大营</th>
                        <th>维度</th>
                        <th>缩略图</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach($data as $v)
                        <tr>
                            <td>{{$v['name']}}</td>
                            <td>{{$v['item']}}</td>
                            <td><img src="{{URL::asset($v['cover'])}}" style="max-width:200px;max-height:200px"><img src="{{URL::asset($v['background'])}}" style="max-width:200px;max-height:200px;margin-left:20px"></td>
                            @if($v['status'] == '1')
                                <td>上线</td>
                            @else
                                <td><a onclick="updown({{$v['id']}})" style="text-decoration:underline; cursor:pointer;">下线</a></td>
                                <td><a onclick="delete_set({{$v['id']}})" style="cursor:pointer;"><i class="glyphicon glyphicon-trash"></i></a></td>
                            @endif
                        </tr>
                    @endforeach
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    function updown(id){
        if(!confirm('是否要上线！')){
            return;
        }
        $.ajaxSetup({headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}});

        var request = {id:id};
        $.post('/admin/camp/setting/updown',request,function(e){
            alert(e.message);
            window.location.reload();
        });
    }

    function delete_set(id){
        if(!confirm('是否要删除！')){
            return;
        }
        $.ajaxSetup({headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}});

        var request = {id:id};
        $.post('/admin/camp/setting/delete',request,function(e){
            alert(e.message);
            window.location.reload();
        });
    }
</script>

<div id="page-wrapper">
</div>
